//
//  RokuPlayer.m
//  Rokumote
//
//  Created by John Roark on 10/7/09.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "RokuPlayer.h"

#include "network.h"


@implementation RokuPlayer

@synthesize ipAddr;

- (id) initWithIP:(NSString *)anIp
{
	if (self = [super init])
	{
		ipAddr = [anIp copy];
	}
	
	return self;
		
}

- (void) setIpAddr:(NSString *) anIp
{
	ipAddr = [anIp copy];
}

+ (RokuPlayer *)createPlayerWithIP: (NSString *) anIp 
{
	return [[self alloc] initWithIP:anIp];
}

- (int) sendCommand: (NSString *) aCmd
{
	char	ip[16] = {0}, cmd[16] = {0};
	
	[ipAddr getCString: ip];
	[aCmd getCString: cmd];
	
	return send_command((const char *)ip, (const char *)cmd);
}

@end
